%% lambda
function [lambda,a_coeff]=lambda_cal(T,P,d_lambda,Q,relative_den)
syms lambda_L
load lambda_data
Ke=Ke/1000;
a_coeff=1;
d_lambda=d_lambda/1000;%mm -> m
mu=mu_cal(T,P);

Re=1.536*Q*relative_den/(d_lambda*mu);
Re2=11/(2*Ke/d_lambda)^1.5;
if Re<Re2
    a_coeff=(1+2.92*d_lambda^2/Q)^-0.1;
end

% lambda_L=solve(lambda_L^-1+...
%                   2.01*log10(Ke/(3.71*d_lambda)+2.51/(Re*lambda_L)));
% lambda_L=double(lambda_L);
% lambda_L=lambda_L^2;


lambda_L=0.01;
for i=1:20
    
    lambda_L1=1/((-2.01*log10(Ke/(3.71*d_lambda)+2.51/(Re*lambda_L^0.5))))^2;
    if abs((lambda_L1-lambda_L)/lambda_L1) <=0.01
        break;
    end
    lambda_L=lambda_L1;
end
    
    
%
E=1;
lambda=lambda_L/E^2;
end